/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jpa.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 *
 * @author Usuario
 */
@Entity
@Table(name = "tarjeta", catalog = "Sig", schema = "", uniqueConstraints = {
    @UniqueConstraint(columnNames = {"idTarjeta"})})
@NamedQueries({
    @NamedQuery(name = "Tarjeta.findAll", query = "SELECT t FROM Tarjeta t"),
    @NamedQuery(name = "Tarjeta.findByIdTarjeta", query = "SELECT t FROM Tarjeta t WHERE t.idTarjeta = :idTarjeta"),
    @NamedQuery(name = "Tarjeta.findByNombre", query = "SELECT t FROM Tarjeta t WHERE t.nombre = :nombre"),
    @NamedQuery(name = "Tarjeta.findByComision", query = "SELECT t FROM Tarjeta t WHERE t.comision = :comision"),
    @NamedQuery(name = "Tarjeta.findByCostoEnvio", query = "SELECT t FROM Tarjeta t WHERE t.costoEnvio = :costoEnvio")})
public class Tarjeta implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idTarjeta", nullable = false)
    private Integer idTarjeta;
    @Basic(optional = false)
    @Column(name = "nombre", nullable = false, length = 45)
    private String nombre;
    @Basic(optional = false)
    @Column(name = "comision", nullable = false)
    private int comision;
    @Basic(optional = false)
    @Column(name = "costoEnvio", nullable = false)
    private double costoEnvio;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tarjeta")
    private List<Comprobante> comprobanteList;
    @OneToMany(mappedBy = "tarjeta")
    private List<Venta> ventaList;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "tarjeta")
    private Cuotas cuotas;

    public Tarjeta() {
    }

    public Tarjeta(Integer idTarjeta) {
        this.idTarjeta = idTarjeta;
    }

    public Tarjeta(Integer idTarjeta, String nombre, int comision, double costoEnvio) {
        this.idTarjeta = idTarjeta;
        this.nombre = nombre;
        this.comision = comision;
        this.costoEnvio = costoEnvio;
    }

    public Integer getIdTarjeta() {
        return idTarjeta;
    }

    public void setIdTarjeta(Integer idTarjeta) {
        this.idTarjeta = idTarjeta;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public int getComision() {
        return comision;
    }

    public void setComision(int comision) {
        this.comision = comision;
    }

    public double getCostoEnvio() {
        return costoEnvio;
    }

    public void setCostoEnvio(double costoEnvio) {
        this.costoEnvio = costoEnvio;
    }

    public List<Comprobante> getComprobanteList() {
        return comprobanteList;
    }

    public void setComprobanteList(List<Comprobante> comprobanteList) {
        this.comprobanteList = comprobanteList;
    }

    public List<Venta> getVentaList() {
        return ventaList;
    }

    public void setVentaList(List<Venta> ventaList) {
        this.ventaList = ventaList;
    }

    public Cuotas getCuotas() {
        return cuotas;
    }

    public void setCuotas(Cuotas cuotas) {
        this.cuotas = cuotas;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTarjeta != null ? idTarjeta.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tarjeta)) {
            return false;
        }
        Tarjeta other = (Tarjeta) object;
        if ((this.idTarjeta == null && other.idTarjeta != null) || (this.idTarjeta != null && !this.idTarjeta.equals(other.idTarjeta))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Tarjeta[idTarjeta=" + idTarjeta + "]";
    }

}
